<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>新增商品信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/themes/icon.css"/>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/demo.css"/>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/admin/css/input1.css"/>

<script src="${pageContext.request.contextPath }/plugins/jQuery/jquery.min.js"></script>
<script src="${pageContext.request.contextPath }/plugins/jQuery/jquery.easyui.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/jQuery/easyui-lang-zh_CN.js"></script>

<script type="text/javascript" src="${pageContext.request.contextPath}/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/ueditor/ueditor.all.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/ueditor/lang/zh-cn/zh-cn.js"></script>


<script>
	$(function(){
//		$.messager.alert('系统消息','子栏目删除成功！');
		// 区域负责人下拉列表
		$('#chargeUser').combobox({
			valueField:'userid',
			textField:'username',
			url:'${pageContext.request.contextPath }/admin/user/listUserByRole/2'
		});
		$('#chargeUser').combobox("setValue",-1);
		
		// 站点类型下拉列表
// 		$('#goods_kind').combobox({
// 			valueField:'value',
// 			textField:'text',
// 			data:[{"value":"1","text":"财务"},
// 				{"value":"2","text":"中心仓"},
// 				{"value":"3","text":"市场/销售"},
// 				{"value":"4","text":"采购/商品"},
// 				{"value":"5","text":"系统调整"},
// 				{"value":"6","text":"其他"},
// 			]
// 		});
		//$('#noticeKind').combobox("setValue",3);
		
		$("a[name='qsave']").linkbutton({text:'保存商品信息',plain:true,iconCls:'icon-ok'});
		
	});
	
	function doSub(){
	
	    var goods_name=$('#goods_name').val();
		if($.trim(goods_name)==''){
			$.messager.alert('系统消息','商品名称必须输入！');
			$('#sname').textbox('textbox').focus(); 
    		return;
		}
		
		var app_name=$('#app_name').val();
		if($.trim(app_name)==''){
			$.messager.alert('系统消息','APP展示名必须输入！');
			$('#app_name').textbox('textbox').focus(); 
    		return;
		}
		
		var goods_kind=$('#goods_kind').combobox('getValue');
		if($.trim(goods_kind)==''){
			$.messager.alert('系统消息','品种类型必须输入！');
			$('#goods_kind').combobox('combobox').focus(); 
    		return;
		}
		
		var goods_spec=$('#goods_spec').val();
		if($.trim(goods_spec)==''){
			$.messager.alert('系统消息','商品规格必须输入！');
			$('#goods_spec').textbox('textbox').focus(); 
    		return;
		}
		
		var goods_place=$('#goods_place').val();
		if($.trim(goods_place)==''){
			$.messager.alert('系统消息','商品产地必须输入！');
			$('#goods_place').textbox('textbox').focus(); 
    		return;
		}
		
		var goods_packing= $('#goods_packing').combobox('getValue');
		if($.trim(goods_packing)==''){
			$.messager.alert('系统消息','商品包装必须输入！');
			$('#goods_packing').combobox('combobox').focus(); 
    		return;
		}
		
		var sale_price=$('#sale_price').val();
		if($.trim(sale_price)==''){
			$.messager.alert('系统消息','当天销售件价格必须输入！');
			$('#sale_price').textbox('textbox').focus(); 
    		return;
		}
		
		var unit_price=$('#unit_price').val();
		if($.trim(unit_price)==''){
			$.messager.alert('系统消息','当天销售公斤价格必须输入！');
			$('#unit_price').textbox('textbox').focus(); 
    		return;
		}
		
		var set_date= $("#set_date").textbox('getValue');
		if($.trim(set_date)==''){
			$.messager.alert('系统消息','设置日期必须输入！');
			$('#set_date').textbox('textbox').focus(); 
    		return;
		}
		
		var store_num=$('#store_num').val();
		if($.trim(store_num)==''){
			$.messager.alert('系统消息','销售库存必须输入！');
			$('#store_num').textbox('textbox').focus(); 
    		return;
		}
		
		var limit_num=$('#limit_num').val();
		if($.trim(limit_num)==''){
			$.messager.alert('系统消息','限购数量必须输入！');
			$('#limit_num').textbox('textbox').focus(); 
    		return;
		}
		
		$('#addgoods').submit();
	}
	
</script>
</head>

<body>
<form method="post" id="addgoods" action="${pageContext.request.contextPath }/goods/addgoods" enctype="multipart/form-data">
<div class="i-container">
	<div class="i-common i-title">新增商品信息
		<span style="color:red; margin-left:30px;">${addMsg }</span>
		<div class="i-btn"><a id="btn" href="javascript:doSub()" name="qsave"></a></div><div style=" clear:both;"></div>
	</div>
	
    <div class="i-common i-cnt-left">商品名称：</div><div class="i-common i-cnt-right">
    	<input name="goodsinfo.goods_name" id="goods_name" class="easyui-textbox" style="width:210px;height:26px"/>
    </div>
    <div class="i-common i-cnt-middle">APP展示名：</div>
    <div class="i-common i-cnt-right">
    	<input name="goodsinfo.app_name" id="app_name" class="easyui-textbox" style="width:210px;height:26px"/>
    </div>
    <div class="i-common i-cnt-middle">商品图片：</div>
    <div class="i-common i-cnt-right">
    	<input class="easyui-filebox" name="img" data-options="prompt:'请选择商品图片...'" style="width:210px" accept="image/gif,image/jpeg,image/png"/>
    </div>
    <div style="clear:both;"></div>
    
    <div class="i-common i-cnt-left">品种类型：</div>
    <div class="i-common i-cnt-right">
    	<input name="goodsinfo.goods_kind" id="goods_kind" url="${pageContext.request.contextPath}/goods/goodskind/GOODS_KIND" data-options="valueField:'dict_code', textField:'dict_name',multiple:false,panelHeight:'auto'" class="easyui-combobox" style="width:210px;height:26px"/>
    </div>
    <div class="i-common i-cnt-middle">商品规格(斤)：</div>
    <div class="i-common i-cnt-right">	
    	<input name="goodsinfo.goods_spec" id="goods_spec" class="easyui-textbox" style="width:210px;height:26px"/>
    </div>
    <div class="i-common i-cnt-middle">商品产地：</div>
    <div class="i-common i-cnt-right">
    	<input name="goodsinfo.goods_place" id="goods_place" class="easyui-textbox" style="width:210px;height:26px"/>
    </div>
    <div style="clear:both;"></div> 
    
    <div class="i-common i-cnt-left">商品包装：</div>
    <div class="i-common i-cnt-right">
    	<input name="goodsinfo.goods_packing" id="goods_packing" url="${pageContext.request.contextPath}/goods/goodskind/GOODS_PACKING" data-options="valueField:'dict_code', textField:'dict_name',multiple:false,panelHeight:'auto'" class="easyui-combobox" style="width:210px;height:26px"/>
    </div>
    <div class="i-common i-cnt-middle">优惠描述：</div>
    <div class="i-common i-cnt-right">	
    	<input name="goodsinfo.discount_desc" id="discount_desc" value="" class="easyui-textbox" style="width:210px;height:26px"/>
    </div>
    <div style="clear:both;"></div> 
    
    
    <div class="i-common i-cnt-left">销售件价：</div>
    <div class="i-common i-cnt-right">
    	<input name="price.sale_price" id="sale_price" class="easyui-textbox" style="width:210px;height:26px"/>
    </div>
    
    <div class="i-common i-cnt-middle">件优惠折扣：</div>
    <div class="i-common i-cnt-right">	
    	<input name="price.minus_price" id="minus_price" class="easyui-textbox" style="width:210px;height:26px"/>
    </div>
    <div class="i-common i-cnt-middle">销售斤价：</div>
    <div class="i-common i-cnt-right">
    	<input name="price.unit_price" id="unit_price" class="easyui-textbox" style="width:210px;height:26px"/>
    </div>
    <div style="clear:both;"></div>
    
    <div class="i-common i-cnt-left">当天设置日期：</div>
    <div class="i-common i-cnt-right">
    	<input name="price.set_date" id="set_date" class="easyui-datebox" style="width:210px;height:26px" readonly="readonly" value="<%=com.whzykj.common.DateUtil.getToday()%>"/>
    </div>
    
    <div style="clear:both;"></div> 
    
    <div class="i-common i-cnt-left">销售库存：</div>
    <div class="i-common i-cnt-right">	
    	<input name="store.store_num" id="store_num" class="easyui-textbox" style="width:210px;height:26px"/>
    </div>
    <div class="i-common i-cnt-middle">限购数量：</div>
    <div class="i-common i-cnt-right">
    	<input name="store.limit_num" id="limit_num" class="easyui-textbox" style="width:210px;height:26px"/>
    </div>
    <div style="clear:both;"></div> 
    
    
    <div class="i-common i-cnt-left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;商品明细：</div>
    <div class="i-common i-cnt-left" style="width:99%; text-align:left; background-color:white; height:auto;">
    	
    	<script name="goodsinfo.goods_detail" id="goods_detail" value="" type="text/plain"></script>
    	
    </div>
    <div style="clear:both;"></div>
</div>

</form>
</body>
</html>
<script type="text/javascript" language="javascript">
	var ue=new UE.ui.Editor({
	    initialFrameWidth:980,
	    initialFrameHeight:350
	});
	ue.render('goods_detail');
	ue.ready(function(){
	   ue.setContent('${goods.goods_detail}');
	});
</script>
